# -*- coding:utf-8 -*-

from sqlalchemy import Column, ForeignKey, Integer, DateTime, String, Text
from sqlalchemy.orm import relationship
from config.database import BaseMixin, Base

class BgProduct(Base, BaseMixin):
    """
    素材产品表
    """
    __tablename__ = "bg_product"

    discount = Column(Integer, nullable=False, comment='折扣%')
    index = Column(Integer, nullable=False, comment='排序')
    month = Column(Integer, nullable=False, comment='套餐周期')
    name = Column(String(255), nullable=False, comment='套餐名称')
    price = Column(Integer, nullable=False, comment='价格')
    status = Column(String(1), nullable=False, comment='状态')
    description = Column(Text, comment='套餐描述')
    is_popular = Column(String(1), default='0', comment='是否热门')
    max_downloads = Column(Integer, default=-1, comment='最大下载次数')
    tip = Column(String(20), nullable=False, comment='套餐类型')
    
    # 关联关系
    prices = relationship("BgProductPrice", back_populates="product")

